﻿<UserControl x:Name="SimpleEditControl" x:Class="NicoView.View.NicoViewCommentSimplyWriteControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:wpfx="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:NicoView.View"
             mc:Ignorable="d" 
             DataContext="{Binding NicoCommentEditorViewModel,Mode=OneWay,Source={StaticResource locator}}"
             d:DesignHeight="300" d:DesignWidth="300" Loaded="SimpleEditControl_Loaded"   >

    <UserControl.Resources>
        <ResourceDictionary Source="Dictionary/CommentEditorDictionary.xaml"/>

    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition  Width="Auto" />
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        
        <ComboBox SelectedIndex="0" Margin="2" IsEditable="True" IsReadOnly="True" Background="{x:Null}" >

            
                <local:CommentCommandSelectStackPanel  >
                <ComboBoxItem>
                    <StackPanel>
                    <Label Content="{Binding CommentColor, Mode=OneWay, Source={StaticResource resources}}"/>

                        <ListBox ItemsSource="{Binding CommentColors}" SelectedItem="{Binding CurrentCommentColor,Mode=TwoWay}" ItemContainerStyle="{DynamicResource CommandListItemStyle}"  HorizontalContentAlignment="Stretch" >

                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel   Orientation="Horizontal"/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>

                            <ListBox.ItemTemplate>
                                <DataTemplate  >
                                    <Border  BorderBrush="Black" BorderThickness="1" ToolTip="{Binding Description}"  Height="12" Width="12"  >
                                        <Border.Background>
                                            <SolidColorBrush Color="{Binding Color}"/>
                                        </Border.Background>
                                    </Border>
                                </DataTemplate>
                            </ListBox.ItemTemplate>

                        </ListBox>
                    
                        <Label Content="{Binding CommentPosition, Mode=OneWay, Source={StaticResource resources}}"/>
                        <ListBox ItemsSource="{Binding CommentPositions}" SelectedItem="{Binding CurrentPosition,Mode=TwoWay}" ItemContainerStyle="{DynamicResource CommandListItemStyle}"  HorizontalContentAlignment="Stretch"  >
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel   Orientation="Horizontal"/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>

                            <ListBox.ItemTemplate>
                                <DataTemplate  >
                                    <Label Content="{Binding Name}" ToolTip="{Binding Description}" />
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <Label Content="{Binding CommentSize, Mode=OneWay, Source={StaticResource resources}}"/>
                        <ListBox ItemsSource="{Binding CommentSizings}" SelectedItem="{Binding CurrentSize,Mode=TwoWay}" ItemContainerStyle="{DynamicResource CommandListItemStyle}"  HorizontalContentAlignment="Stretch"  >
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel   Orientation="Horizontal"/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemTemplate>
                                <DataTemplate  >
                                    <Label Content="{Binding Name}" ToolTip="{Binding Description}" />
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>
                   
                </ComboBoxItem>
            </local:CommentCommandSelectStackPanel>

        </ComboBox>

        <ToggleButton Style="{DynamicResource AnonymousButtonStyle}"  Grid.Column="1" x:Name="AnonymousButton" Content="184" IsChecked="{Binding AnonymousSend}"  Margin="2" DataContext="{Binding SettingConsoleViewModel, Mode=OneWay, Source={StaticResource locator}}"  />
        <ToggleButton Style="{DynamicResource OwnerButtonStyle}" Grid.Column="2" x:Name="OwnerButton" Content="運営コメ" IsChecked="{Binding OwnerSend}" Margin="2" DataContext="{Binding SettingConsoleViewModel, Mode=OneWay, Source={StaticResource locator}}" />
        <TextBox Style="{DynamicResource CommentEditTextStyle}" x:Name="EditText"  Grid.Column="3" Margin="2"  UndoLimit="60" >

            <TextBox.InputBindings>
                <KeyBinding Key="Return"  CommandParameter="{Binding Text, ElementName=EditText}" Command="{Binding CommentWriteExecuteCommand, Mode=OneWay}"/>
            </TextBox.InputBindings>
        </TextBox>
        
        <Button x:Name="CommentSubmitButton" Grid.Column="4" Margin="2" Content="送信" Command="{Binding CommentWriteExecuteCommand, Mode=OneWay}" CommandParameter="{Binding Text, ElementName=EditText}" />
        
    </Grid>
</UserControl>
